package com.speedy.course.db.converter

import androidx.room.TypeConverter
import com.speedy.course.db.entity.LessonExtraInfo
import com.speedy.course.ext.fromJson
import com.speedy.course.ext.toJson

object RoomConverter {

    @TypeConverter
    fun lessonExtraInfoToString(userInfo: LessonExtraInfo?):String?{
        if(userInfo == null){
            return null
        }
        return userInfo.toJson()
    }

    @TypeConverter
    fun stringToLessonExtraInfo(userInfo: String?): LessonExtraInfo?{
        if(userInfo == null){
            return null
        }
        return userInfo.fromJson()
    }
}